set(CMAKE_CXX_STANDARD 14)
set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(WIN32)
  if(NOT MSVC)
    message(FATAL_ERROR "On Microsoft Windows, only Visual Studio is support")
  endif()
  add_definitions("-DEUDAQ_PLATFORM=PF_WIN32")
  add_definitions("-DEUDAQ_FUNC=__FUNCTION__")
  add_definitions("/wd4251") # disables warning concerning dll-interface (comes up for std classes too often)
  add_definitions("/wd4996") # this compiler warnung is about that functions like fopen are unsafe.
  add_definitions("/wd4800") # disables warning concerning usage of old style bool (in root)
elseif(APPLE)
  if(NOT ((CMAKE_COMPILER_IS_GNUCC) OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
    message(FATEL ERROR "On Unix/Linux like system, only GCC and Clang is support")
  endif()
  add_definitions("-DEUDAQ_PLATFORM=PF_MACOSX")
  add_definitions("-DEUDAQ_FUNC=__PRETTY_FUNCTION__ ")
  list(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,-undefined,error")
else()
  if(NOT ((CMAKE_COMPILER_IS_GNUCC) OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")))
    message(FATEL ERROR "On Unix/Linux like system, only GCC and Clang is support")
  endif()
  add_definitions("-DEUDAQ_PLATFORM=PF_LINUX")
  add_definitions("-DEUDAQ_FUNC=__PRETTY_FUNCTION__ ")
  if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    #workaround for xfer_bufptrs public/private bug
    #http://mailman.isi.edu/pipermail/ns-developers/2016-February/013378.html
    #https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69470
    add_definitions("-include sstream")
  endif()  
  list(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,--no-undefined")
endif()
